function slideshow(...args) {  
  // 时间  图片宽度  轮播图滚轮盒子  左箭头  右箭头  小圆点

  // 定时器终止变量
  var times = undefined;
  var time = undefined;

  // 时间 
  var ttt = args[0];
  // 图片宽度
  var boxWidth = args[1];
  // 轮播图滚轮盒子
  var box = args[2];

  // 左箭头
  var left = args[3];
  // 右箭头
  var right = args[4];  

  // 小圆点
  var point = args[5];

  // 存储所有图片占有的大小
  var control = [];
  for (let i = 0, t = -(boxWidth); i < (box.offsetWidth / -boxWidth); i++) {    
    control[i] = t = t + boxWidth;
  }

  
/* ---------------------------------------------------------------- */
  // 移动图片
  function fun(t, numberBox) {            
    time = setInterval(() => {
      // 添加值
      box.style.marginLeft = (box.offsetLeft + t)+"px";  
      // console.log("盒子边距："+box.offsetLeft+"/ 预设盒子最大值"+numberBox)
      
      // 满足(盒子值+移动距离)停止，然后重新调用定时器
      if(box.offsetLeft === numberBox) {      
        clearInterval(time);
        
        // 控制开关
        if(point != null) {
          // 小圆球颜色
          displayPoints(point);
        }        
        
        // 启动定时器函数
        timeFuns();
      }
    }, ttt);
  }
  // 定时器函数
  function timeFuns() {
    times = setInterval(() => {  
        // 重复循环 ('未满足条件'循环移动，'满足条件'重置值然后重新启动)
        if(box.offsetLeft != -(box.offsetWidth + boxWidth)) {       
          fun(-10, (box.offsetLeft + boxWidth));                      
                  
          clearInterval(times);
        }else {
          box.style.marginLeft = "0px";
          
          // 控制开关
          if(point != null) {
            // 小圆球颜色
            displayPoints(point);
          }

          clearInterval(times); clearInterval(time);
          
          // 启动定时器
          timeFuns()
        }                   
    }, 5000);
  }
  // 定时器开启
  timeFuns();
/* ---------------------------------------------------------------- */ 


/* ------------------------------------------------------ */
  // 左右箭头
  function direction(left, right) {    
    // 左箭头
    left.onclick = function() {
      switch(box.offsetLeft) {
        case control[0]: 
          clearInterval(times); clearInterval(time);                 
          box.style.marginLeft = "-600px";
          // 启动定时器
          timeFuns();
          break;
        case control[1]: 
          clearInterval(times); clearInterval(time); 
          fun(10, (box.offsetLeft + (-boxWidth)));
          break;
        case control[2]:
          clearInterval(times); clearInterval(time); 
          fun(10, (box.offsetLeft + (-boxWidth)));        
          break;
        case control[3]:
          clearInterval(times); clearInterval(time); 
          fun(10, (box.offsetLeft + (-boxWidth)));        
          break;
        case control[4]:
          clearInterval(times); clearInterval(time); 
          fun(10, (box.offsetLeft + (-boxWidth)));        
          break;          
      }
    }
    // 右箭头
    right.onclick = function() {    
      switch(box.offsetLeft) {
        case control[0]: 
          clearInterval(times); clearInterval(time); 
          fun(-10, (box.offsetLeft + boxWidth));        
          break;
        case control[1]: 
          clearInterval(times); clearInterval(time); 
          fun(-10, (box.offsetLeft + boxWidth));
          break;
        case control[2]: 
          clearInterval(times); clearInterval(time); 
          fun(-10, (box.offsetLeft + boxWidth));
          break;
        case control[3]: 
          clearInterval(times); clearInterval(time); 
          fun(-10, (box.offsetLeft + boxWidth));
          break;
        case control[4]:
          clearInterval(times); clearInterval(time);        
          box.style.marginLeft = "0px";
          // 圆点颜色变化
          displayPoints(point);
          // 启动定时器
          timeFuns();
          break;
      }
    }
  }
  if(left != null && right != null) {    
    direction(left, right)
  }
/* ------------------------------------------------------ */
  

/* ----------------------------------------------------------------------- */
  // 显示圆点
  function displayPoints(point) {
    // 小圆点 
    function points() {        
      // 初始话所有class类
      for(let i = 0; i < point.length; i++) { point[i].className = "roundBox-point"; };
      // 匹配所有图片位置与齿条当前位置，并返回图片位置下标
      var controlData = control.filter((value) => {
        return value == box.offsetLeft;
      });
      controlData = controlData.toString() - 0;
      
      if(box.offsetLeft === controlData) {
        // 添加下标并修改对应的 类 。
        point[control.indexOf(controlData)].className = "roundBox-point colors";
      }     
    }   
    points();
    // 点击小圆点右图片跳动      
    for(let i = 0; i < point.length; i++) {
      point[i].onclick = function() {
        clearInterval(time); 
        clearInterval(times);
        box.style.marginLeft = (boxWidth * i)+"px";
        
        // 改变小圆点颜色
        points();
        // 启动定时器
        timeFuns();
      }
    }
  }
  // 控制开关
  if(point != null) {
    // 小圆球颜色
    displayPoints(point);
  } 
/* ----------------------------------------------------------------------- */

}

export {
  slideshow,
}


